package com.xzcf.service;

import com.xzcf.entity.Item;
import java.util.List;
import com.xzcf.entity.ItemDAO;

public class ItemService {
	private ItemDAO itemDAO;
	
	public ItemDAO getItemDAO(){
		return itemDAO;
	}
	public void setItemDAO(ItemDAO itemDAO){
		this.itemDAO = itemDAO;
	}
	
	public void saveItem(Item item){
		itemDAO.save(item);
	}
	public List getEntityList(){
		return itemDAO.findAll();
	}
	public List getEntityListByStatus(String st){
		return itemDAO.findByStatus(st);
	}
	public List getEntityListByName(String name){
		return itemDAO.findByName(name);
	}
	public List getEntityListByType(String type){
		return itemDAO.findByType(type);
	}
	public List getEntityListByStatusAndName(String status,String name){
		return itemDAO.findByStatusAndName(status,name);
	}
	public List getEntityListByStatusAndType(String status,String type){
		return itemDAO.findByStatusAndType(status,type);
	}
	public Item getEntityById(String id){
		return itemDAO.findById(id);
	}
	public void updateItemInfo(Item item){
		itemDAO.attachDirty(item);
	}
	public List getEntityListByDonorName(String donorName){
		return itemDAO.findByDonorName(donorName);
	}
	public List getEntityListByOwnerName(String ownerName){
		return itemDAO.findByOwnerName(ownerName);
	}
}
